package com.gr.labbackend.controller.manage.material;

import com.alibaba.fastjson.JSONObject;
import com.gr.labbackend.service.manage.material.UpdateMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class UpdateMaterialController {

    @Autowired
    private UpdateMaterialService updateMaterialService;

    @PostMapping("/api/manage/material/update-material")
    public JSONObject updateMaterial(@RequestParam("id") int id,
                                     @RequestParam("title") String title,
                                     @RequestParam(value = "file", required = false) MultipartFile file) {
        return updateMaterialService.updateMaterial(id, title, file);
    }

}
